<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
	    <title>大旺福</title>
	    <meta name="renderer" content="webkit">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	    <meta name="apple-mobile-web-app-capable" content="yes">
	    <meta name="format-detection" content="telephone=no">
	    <link rel="stylesheet" href="/assets/layui/css/layui.css" media="all">
	    <link rel="stylesheet" href="/assets/layui/css/global.css" media="all">
	</head>
	<body>
		<form class="layui-form" action="">
		  <div class="layui-form-item">
		    <label class="layui-form-label">行内选择框</label>
		    <div class="layui-input-inline">
				<select name="attr_base_0" lay-filter="base">
					{literal}
					<option value="">请选择包装方式</option>  
					<option value='["id":"2","name":"包装方式"]'>散装</option>  
					<option value='{"id":"2","name":"包装方式","type":"1","form_type":"select","value":"{\"id\":\"4\",\"attribute_id\":\"2\",\"category_id\":\"5\",\"value_name\":\"包装\",\"shop_id\":\"0\",\"create_time\":\"2016-10-03 10:00:00\"}"}'>包装</option>  
					{/literal}
				</select>
		    </div>
		    <div class="layui-input-inline">
		      <select name="quiz1">
		        <option value="">请选择省</option>
		        <option value="浙江" selected="">浙江省</option>
		        <option value="你的工号">江西省</option>
		        <option value="你最喜欢的老师">福建省</option>
		      </select>
		    </div>	    
		  </div>			
		  <div class="layui-form-item">
		    <label class="layui-form-label">复选框</label>
		    <div class="layui-input-block">
		      <input type="checkbox" name="like[write]" title="写作">
		      <input type="checkbox" name="like[read]" title="阅读" checked="">
		      <input type="checkbox" name="like[game]" title="游戏">
		    </div>
		  </div>			
		  <div class="layui-form-item layui-form-text">
		    <label class="layui-form-label">编辑器</label>
		    <div class="layui-input-block">
		      <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
		    </div>
		  </div>			
		  <div class="layui-form-item">
		    <div class="layui-input-block">
		      <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
		      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		  </div>
		</form>	
    		{include file="layout/footerJs.html"}
    		{literal}
		<script>
		layui.use(['form', 'layedit', 'laydate'], function(){
		  var form = layui.form()
		  ,layer = layui.layer
		  ,layedit = layui.layedit
		  ,laydate = layui.laydate;
		  
		  //创建一个编辑器
		  var editIndex = layedit.build('LAY_demo_editor');
		 
		  //自定义验证规则
		  form.verify({
		    title: function(value){
		      if(value.length < 5){
		        return '标题至少得5个字符啊';
		      }
		    }
		    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
		    ,content: function(value){
		      layedit.sync(editIndex);
		    }
		  });
		  
		  
		  
		  //监听提交
		  form.on('submit(demo1)', function(data){
			
		  	console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
		  	console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
		  	console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
		  	return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
		  
		  
		});
		</script>
		{/literal}
	</body>
</html>
